# At the top of settings/base.py

import os
from os.path import join, abspath, dirname

CONF_DIR = lambda *dirs: join(abspath(dirname(__file__)), *dirs)
BASE_DIR = CONF_DIR("..", "..")
DIR_AT_ROOT = lambda *dirs: join(abspath(BASE_DIR), *dirs)

SECRET_KEY = os.environ['DJ_SECRET_KEY']
DEBUG = True

MEDIA_ROOT = DIR_AT_ROOT("media")

STATIC_ROOT = DIR_AT_ROOT("static0")

# STATICFILES_DIRS = (
#     DIR_AT_ROOT("media/author_headshots"),
#     ##DIR_AT_ROOT("author_headshots"),  ??? media ???
# )

STATIC_URL = '/static/'

TEMPLATE_DIRS = (
    DIR_AT_ROOT("templates"),
)

ALLOWED_HOSTS = []

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'ft',
    'user_contacts',
    'news',
    'polls',
    'weblog',
    'books',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'contacts.urls'
WSGI_APPLICATION = 'contacts.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        }
    }

LANGUAGE_CODE = 'zh-CN'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = False
